Skip to content

feat: Voice master, clearer levels and phone capture, with team folder sync hardening - #8

Merged
nodemode-ai merged 34 commits into
mainfrom
fix/review-2026-11-28
Nov 30, 2026
Merged

nodemode-ai merged 34 commits into
mainfrom
fix/review-2026-11-28

Conversation

@gbarnai

@gbarnai gbarnai commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR carries the team folder sync hardening and two features for the next release (issues #6 and #7).

Team folder sync hardening

  • Device lists from other computers in a team folder now name only plain file names. A name may not have separators, a leading dot, Windows reserved characters or control characters. It may not end with a dot or space, and it may not be a Windows device name.
  • The files that stay on each computer (share, relay, teamsync, engage and workspace state, in any letter case) are refused in another computer's list and when copying, and they are still never published.
  • The folder in a device entry must be the recording's own folder or that device's own .by- folder. When this computer publishes, it ignores a changed folder in its own list.
  • A recording folder or a file in the share that is a link is not read, written or cleaned up through. Only regular files are copied in.
  • New tests in tests/teamsync-folder-names.test.ts cover file names, folders, letter case, Windows names, linked folders and linked files.
  • On Windows, an npm .cmd shim for an agent client command is resolved to the Node script or program it wraps and run with a plain argument list, without cmd.exe.
  • When cmd.exe is still needed, any argument holding a character cmd.exe treats specially (& | < > ^ ( ) ! % " or a control character) is refused with a plain message, and long text should go through stdin or a file.
  • The team folder sync never syncs Windows 8.3 short names, and a file renamed into place counts only when the folder lists it under exactly the expected name.
  • New tests: tests/agents-win-launch.test.ts (27, runs on any OS) and four more cases in tests/teamsync-folder-names.test.ts.

Voice master and clearer levels (closes #6)

  • Voice master microphone preset: echo cancellation, noise suppression and auto gain all off, mono 48 kHz, and a lossless 24-bit WAV written next to the Opus track (master-host-mic.wav). An optional 8 s room tone opens the take. Echo cancellation is now a real setting in the standard preset too.
  • recording.json gains a capture block: each track's applied settings, the quality asked for and what was delivered, the master WAV, clip times and the level check. The studio says when a camera or screen delivers less than the preset.
  • Always-visible meters under the stage and in the record bar: a dBFS scale with a green -18 to -12 band, peak hold with a number, a clip light that stays on until clicked, and plain hints when speech stays too quiet or keeps hitting the red.
  • Check level before a take, and clip counts with times when it stops.
  • Export with sound: one MP4 with picture and sound from the player; track files are labelled picture only or sound only.
  • Script mode: one paragraph at a time on the stage; Space adds a chapter with the paragraph as its text.

Phone capture for app walkthroughs (closes #7)

  • A Phone panel in the studio: iPhone or iPad over USB in the Mac app (AVFoundation, after the CoreMediaIO screen capture opt-in), Android over USB or Wi-Fi through adb and the scrcpy server (downloaded at first use and checked against its published SHA-256; adb is never bundled), the iOS Simulator, an AirPlay mirror window, or a phone recording to narrate over.
  • The phone picture keeps its own size and frame rate; its sound is its own track. Android show taps and a clean status bar are turned on for the take and restored after.
  • Import a phone recording into the library, send a video from the phone page, and a Phone layout export (blurred fill, device frame, or beside the camera).

Player links

  • Player links in MCP answers and command line output no longer carry the app's run token. Each recording's link carries its own player key, which opens only that recording's player and its media through /api/player/:id.
  • Player keys come from one secret in the data folder. Settings > Agents > Player links > Rotate (POST /api/agents/player-links/rotate, a window command, or formrec url --rotate-player-links) replaces it, which stops every link given so far.
  • Links get their form in one place in buildServer, so every core and feature tool is covered; with no player base (the relay bridge), nothing changes.
  • The client opens a player link as a read-only player view and moves the key out of the address bar.
  • Tests: server and MCP checks of key scope and rotation, and a Chromium test of the player link view and the Settings Rotate button.

Tests

  • npm run check and npm run build pass; agents check is in step (121 tools).
  • The sync, Voice master, levels, script, capture metadata, phone and studio tests pass together on the merged branch: 14 files, 128 tests.
  • The full suite was run on each branch on macOS; failures seen locally are browser, FFmpeg encoder and live-stream tests that need tools this machine lacks or are Linux only, and do not touch these changes.
  • The phone sources were not run against real devices yet; the iPhone, Android and AirPlay paths need a hands-on check.

For the owner

  • Two sync behaviour changes are described in the comment below.
  • scrcpy server is fetched at first use (Apache-2.0, recorded in NOTICE.md); bundling it instead is an option.
  • A few related items need an owner decision; they are listed separately, not here.

How to ship

  • Independent of other repos. No version bump here; release as usual.

…older

A team folder's device lists now name only plain files and the recording's
own folder or its .by-<device> folder; any other entry is not followed, and
this computer publishes only to its own folder in the share.
Names another computer lists now also leave out the files that stay on
each computer (any letter case), names Windows reads as another file and
control characters. A recording folder or file in the share that is a
link is neither read nor written through.
…er sync

Windows 8.3 short names (a tilde followed by a digit) are never synced, and a file
renamed into place counts only when the folder lists it under exactly that name.
An npm .cmd shim is resolved to the Node script or program it wraps and run with an
argument list. When cmd.exe is still needed, any argument holding a character cmd.exe
treats specially is refused with a plain message.
Find Android phones and emulators (adb devices), booted iOS Simulators
(simctl) and the AirPlay receiver's mirror window; never bundle adb.
Show taps and SystemUI demo mode are read, applied and put back.
The scrcpy server 3.3.1 is downloaded at first use and accepted only
with its published SHA-256; the client side of its protocol and a small
Matroska writer keep the phone's own timestamps. Producers record the
Simulator, the AirPlay window (FFmpeg avfoundation, cropped), Android
through scrcpy, and screenrecord as the fallback.
The phone feed registers the take's screen track and a phone audio
track (?source=phone, host-phone) when the take starts and fills them
when it stops, joining paused segments with the picture stream copied.
A phone recording can be uploaded and narrated over; phone layouts
(portrait with blurred fill, device frame, beside the camera) are made
on export. Routes under /api/phone/sources, feed, files, recordings.
The shell opts in to CoreMediaIO screen capture devices at start,
lists the muxed iOS devices and records one with AVFoundation into the
capture folder the server named, with pause and resume. Uses objc2
crates already in the lock. Windows and Linux answer that it needs a
Mac.
The Phone panel lists an iPhone on USB, Android devices and emulators,
booted Simulators, the AirPlay mirror and a phone recording, says what
is missing and how to fix it, and records the chosen one in place of
the screen. Import a phone recording uses the library's importer, and
the phone page can send a video already on the phone through the
native upload on the guest listener.
A Voice master take uploads a 48 kHz 24-bit WAV beside the Opus track
through the studio feature (POST /api/studio/takes/:id/master?seq=n and
/master/end), in ordered chunks like a track's, to one fixed file name.
The first chunk must carry the canonical PCM header (shared/wav.ts); the
sizes are written when the take ends. It is not a session track, so the
player, exports and transcripts never play it twice.

recording.json gains capture: the microphone preset, each track's
getSettings(), the quality asked for, room tone and the clips with their
take times. The master is described from the server's own file at save,
never from the client's word.
The microphone opens with the chosen preset's constraints instead of
echo cancellation hard-coded on: Standard follows Effects' three
switches, Voice master turns all three off, asks for mono 48 kHz 24-bit,
skips every plugin's microphone hook, offers 8 s of room tone and writes
the lossless WAV from an AudioWorklet tap.

The same tap feeds a large meter under the stage and a compact one in
the record bar, in every layout: a -60 to 0 dBFS scale with the too-quiet
zone, the green -18 to -12 band and the red zone, a 1.5 s peak hold with
its number, a clip light that latches until clicked with the count, and
plain hints after quiet speech or repeated red. A pre-roll check advises
turning the input up or down; clips are counted with their take times
and reported when the take stops. The studio notes when a camera or
screen delivers less than the quality preset. Effects' preview meter
reads the same zones.
Load a Markdown or text script, or paste one, and the stage shows one
paragraph at a time. While the take records, Space (or Done) marks the
paragraph done and starts the next paragraph's chapter at that moment,
with the paragraph's words as the chapter's text, so the audio lines up
with the script for training and editing. The first chapter starts when
reading starts (after room tone). Space is taken from a focused button
while a script is read, so it never presses Pause or Stop, and the Slides
layout keeps its own Space.
Export with sound renders the camera or the screen with the microphone
into one H.264 and AAC MP4 that QuickTime plays, at the size the picture
was recorded, through edit's one exporter (so edits and trims apply).
The player's Tracks list says the camera and screen files are pictures
only and the microphone file is sound only, and downloads carry that in
their names. A Capture panel shows the preset, what the browser applied
to each track, the size asked for and delivered, the clips as links to
their times, every file of the take with what it holds, and the WAV
master.
…Chromium

A fake microphone plays quiet tone with a full-scale clap every four
seconds: the clip light latches and clears, the too-quiet hint shows,
the level check advises, the save screen lists the clips, the WAV is
pcm_s24le 48 kHz mono with DSP flags false in recording.json, and Space
drops a chapter per paragraph. A Standard camera take opens with echo
cancellation off when Effects says so, notes the delivered size, shifts
nothing at 4x CPU throttling, and exports an MP4 with H.264 and AAC.
…ce-and-phone

# Conflicts:
#	src/HASHOUT_LOG.md
…other entry

Synced file names are now printable ASCII only. Before a file is placed, the target
folder is read and the move is refused when an existing entry differs from the name
but matches it once case is folded. Files are linked into place and fail when the
name is taken, and an earlier version is removed only under exactly the same name.
…private name

An earlier version under the same name is now replaced by a single rename, so a
failed step cannot leave the file missing. A new name is still taken by a hard link,
with a rename where the file system cannot link. Each temporary file is created new
under a random name, hashed through the handle that wrote it, and placed only while
its path still holds that same regular file.
Each incoming or outgoing file is now copied and verified in a staging folder inside
FormRec's own data folder, and is checked to be the same regular file right before it
moves. On the same volume it is renamed or linked into place. When the target is on
another volume it is copied with an exclusive create and the copy's hash is checked.
@gbarnai
gbarnai requested a review from nodemode-ai November 29, 2026 18:47
@gbarnai

gbarnai commented Nov 29, 2026

Copy link
Copy Markdown
Contributor Author

Behaviour change to decide on: a synced file renamed only by letter case on another computer (for example NOTES.TXT to notes.txt) is now left unsynced on this computer until it is renamed by hand, because names that differ only by case are no longer written over each other. Publishing into a share on a different volume also replaces an earlier version by removing it before the copy, so a failed copy leaves it missing until the next pass.

@gbarnai gbarnai changed the title fix: keep team folder sync inside the shared recording folders feat: Voice master, clearer levels and phone capture, with team folder sync hardening Nov 29, 2026
Links in MCP answers and the command line's JSON no longer carry the
run's token. Each recording's link carries a player key, an HMAC of its
id under one secret in the data folder, checked by a gate that answers
/api/player/:id and its media only. Settings, Agents, Player links,
Rotate (POST /api/agents/player-links/rotate, also a window command and
formrec url --rotate-player-links) replaces the secret so every link
given so far stops working. The client opens such a link as a read-only
player view.
…links

A secret file that holds no secret is replaced, a file system with no
hard links places the first secret with an exclusive copy, and when no
secret can be kept a tool's answer still arrives with a link that has
no key and no token.
The test job had no FFmpeg, so 44 test files failed with spawnSync ffmpeg ENOENT. Install ffmpeg (FFprobe comes with it) and poppler-utils, which the picture guide's PDF test reads with pdftotext and pdfimages. Tesseract, Xvfb and the phone tools skip when absent.
Before permission, WebKit and Chromium list devices with empty labels or a
default entry only, and nothing refilled the lists when a device was plugged
in. The studio now refills both lists on devicechange (debounced), when the
window is shown or focused again, when a permission becomes granted and after
Get ready opens the devices, keeping the current choice, then the saved one,
then the system default.

Refresh devices beside the pickers rebuilds both lists; when names are hidden
it asks for microphone (and camera, when the layout uses it) permission once,
stops those tracks at once and lists again, then says what it found in a
status line with reserved height. The phone panel lists its sources again on
devicechange too.

Agents: formrec_studio_state carries the device names the studio last found,
and formrec_studio_refresh_devices asks the open studio for the same refresh
(askPermission optional) through /api/studio/devices, answered with labels
only.
A hosted Linux runner for a private repository has two cores, so vitest ran
one test file at a time and the whole suite needed about an hour, past the
job limit. Four runners now each take a quarter of the files and write a
blob report with coverage; the test job type checks and merges them into
one report.

docs/api.md lists the studio device routes, as the generated API list
test expects.
…ux runners

The folder sync checked a staged file by device and inode before placing
it. Linux file systems reuse a freed inode number for the next file
created, so a staged file deleted and written again could pass that check.
The placement check now also hashes the staged file through a handle
opened without following links.

Tests on a Linux runner:
- the astats noise floor reads FFmpeg 8's "RMS through dB" as well;
- the Android test runs Gradle 8.10 with a JDK it supports (17 to 23),
  using JAVA_HOME_21 or JAVA_HOME_17 when the default JDK is newer;
- the Firefox walks of the interactive demo and the WebKit take skip when
  those Playwright browsers are not installed;
- the live link latency check, which reads the picture with Tesseract,
  skips when Tesseract is not installed.
The share page swaps its video source to change quality. While the new
source loads, the element reads paused, so a pause pressed then started
playback instead, and the end of the swap resumed playing whatever the
person chose. The page now keeps the person's choice during a swap and
applies it when the new source shows. A browser test holds the new
source back and presses play and pause inside the swap.

The avatar share test records the voice and the mouth as they change,
so a slow machine that checks late still sees that both followed the
video.
…test

Each share started FFmpeg encodes of the whole rendition ladder and every save
an automatic poster that decodes through the avatar's per-pixel mask filter.
The test reads neither, and on a 2-vCPU runner they starved the share listener
and Chromium until a page.goto timed out. Stop the rendition queue and turn the
automatic posters off for this file, as the other share and edit tests do.
The walkthrough baseline takes page.screenshot({ clip }) while the screencast
runs. Chromium then draws only the clip for a moment and sends that frame to
the screencast at the clip's size, so the video showed a zoomed flash. Under
load the flash was held for several frames and scene detection read it as a
page change, which moved a walkthrough chapter seconds before its page and
dropped the real cut that followed (scenes-chapters on CI: -2989 ms).

A frame is now used only when its size matches the page's viewport. A new test
records clipped screenshots during a capture and checks every frame of the
video.
Dropping frames by their size was not enough: on a Linux runner one frame
drawn for a clipped screenshot still reached the video. Screencast.during now
holds the capture around work that draws the page for something other than
the viewer, and frames drawn in that span, by their own timestamp, are left
out. The runner takes each step's baseline picture inside it, and the replay
stand-in passes the work through.
…ection

The test server was FFmpeg with -listen 1, which serves one connection. When
the destination's first attempt after a restart ended early, the sender's
retries found the port closed and the destination failed with ECONNREFUSED.
The server now listens again after a connection ends, as a real ingest server
does, each connection to its own file, and the test still requires the
destination to go live and that connection to carry more than 2 s of feed.
@nodemode-ai
nodemode-ai merged commit 6899659 into main Nov 30, 2026
7 checks passed
@nodemode-ai
nodemode-ai deleted the fix/review-2026-11-28 branch November 30, 2026 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants